<template>
	<!-- 底部购物栏 -->
	<view class="btm_tool">
		<view v-show="uid" class="tool_item">
			<view class="iconfont icon-kefu"></view>
			<view>客服</view>
			<button open-type="contact"></button>
		</view>
		<view class="tool_item">
			<view class="iconfont icon-yixianshi-"></view>
			<view>分享</view>
			<button open-type="share"></button>
		</view>
		<!-- <navigator open-type="switchTab" url="/pages/index/index" class="tool_item">
			<view class="iconfont icon-gouwuche"></view>
			<view>购物车</view>
		</navigator> -->
		<view v-if="uid" class="tool_item btn_cart ">
			加入收藏
		</view>
		<view v-if="uid" class="tool_item btn_buy" @click="submitOrder" >
			立即购买
		</view>
		<view v-if="!uid" class="tool_item btn_buy" @click="toLogin" >
			前往登录
		</view>
	</view>
</template>

<script>
	export default {
		props:{
		   uid:null,
		   salerId:null,
		   goodsId:null
		   // goodsIds:{
			  //  type:Array,
			  //  default:()=>[]
		   // }
		},
		methods: {
			// 
			async submitOrder(){
				console.log(this.goodsId);
				// 提交信息
				// const res = await submitOrderApi({goodsId:this.goodsId})
				// console.log(res);
				// 跳转
				uni.navigateTo({
					url:`/pages/order/order-submit?id=${this.goodsId}`
				})
			},
			
			// 登录
			toLogin(){
				uni.navigateTo({
					url:"/pages/login/login"
				})
			}
		}
	}
</script>

<style lang="less"  scoped >
.btm_tool{
    // 固定位置
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 90rpx;
    background-color: #f6f5f8;
    display: flex;
    // 上上边框
    border-top: 1rpx solid #ccc;
    .tool_item{
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        // 相对定位
        position: relative;
        
        button{
            // 绝对定位
            position: absolute;
            width: 100%;
            height: 100%;
            // 透明
            opacity: 0;
        }
    }
    .btn_cart{
        flex: 2;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background-color: rgb(221, 144, 27);
        color: aliceblue;
        font-size: 32rpx;
        font-weight: 600;
    }
    .btn_buy{
        flex: 2;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background-color: #5ca45b;
        color: aliceblue;
        font-size: 32rpx;
        font-weight: 600;
    }
}
</style>